package servlet;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.IOException;

public class ForwardServlet3 extends HttpServlet {
    private static final long serialVersionUID = 111269129323067099L;

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        ServletContext app = req.getServletContext();
        String servletName = "forwarded-servlet";
        // 为请求设置属性
        req.setAttribute("servlet-name", servletName);
        RequestDispatcher dispatcher = app.getNamedDispatcher(servletName);
        dispatcher.forward(req, resp);
    }
}
